﻿// -----------------------------------------------------------------------
// <copyright file="GeneradorDeSelect.cs" company="Hexacta S.A.">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace generador
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data;
    using gudusoft.gsqlparser;
    using System.Collections;
    using SQLVis.Entidades;

    /// <summary>
    /// </summary>
    public static class GeneradorDeInsert
    {
        //limitaciones hasta el momento: TODOS LOS VALORES SON ENTEROS, Y AL AZAR SON FRUTA :)
        public static InfoDeLaQuery GenerarInsert(DataSet ds, Dictionary<string, int> diccionario_Tabla_Cantidad_de_Registros)
        {

            TInsertSqlStatement statement1 = new TInsertSqlStatement(TDbVendor.DbVMssql);
            statement1.IsParsed = true;

            InfoDeLaQuery info = new InfoDeLaQuery();
            info.Query = statement1;

            statement1.Table = new TLzTable(statement1);
            DataTable tabla_elegida = Utiles.ElegirTablaAlAzar(ds);
            int cantidad_de_columnas=tabla_elegida.Columns.Count;
            statement1.Table.TableName = tabla_elegida.TableName;

            TLzFieldList fieldlist = new TLzFieldList(false);
            for (int i = 0; i < cantidad_de_columnas; i++)
            {
                TLzField field1 = new TLzField(statement1);
                field1.FieldName = Utiles.random.Next(198).ToString();
                fieldlist.Add(field1);
            }

            statement1.MultiValues.Add(fieldlist);

            info.RowsExamined = 1;
            info.RowsSent = 1;
            info.LockTime = Utiles.random.Next(0, Constantes.TiempoMaximoLockeoDeTabla);

            return info;
        }

    }
}
;